package com.per.mybootall.designMode.agencyModel.dynamicModel;

import java.lang.reflect.Proxy;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: yyy
 * Date: 2022/1/18
 * Time: 11:05
 * Description:测试动态代理
 */
public class Test {
    public static void main(String[] args) {
        DynamicProxy dynamicProxy=new DynamicProxy(new YyySay());

        //获取代理类实例
        Hello hello = (Hello)(Proxy.newProxyInstance(Hello.class.getClassLoader(), new Class[] {Hello.class},dynamicProxy));
        hello.sayHello("齐可");
        hello.sayBay("齐可");
    }
}
